#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <assert.h>

char* sim_strncat(char* dest, const char* src, size_t n)
{
	char* ret = dest;
	assert(dest && src);
	while (*dest != '\0')
	{
		dest++;
	}
	while (n && *src != '\0')
	{
		*dest = *src;
		dest++;
		src++;
		n--;
	}
	*dest = '\0';
	return ret;
}

int main()
{
	char arr1[20] = "abc";
	char arr2[] = "deff";
	sim_strncat(arr1, arr2, 5);
	printf("%s", arr1);
	return 0;
}